Skip to main content

Execute Reader

AutomatR.PostgreSQL.Database.ExecuteReader

The "Execute Reader" activity in AutomatR for PostgreSQL databases allows you to execute a query on a database and retrieve the query result as a DataTable. This activity is useful when you need to fetch data from a PostgreSQL database for further processing within your workflow.

Properties

NameDescription
Input
ConnectionProvide an NpgsqlConnection variable which will be used to establish a database connection. NpgsqlConnection variables containing the connection to be used.
Command TextProvide a SQL query in string format. String variables containing the SQL query to be executed.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variables containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Execute Reader" activity. Integer variables containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.
Command TimeoutProvide the amount of time (in milliseconds) to wait for the SQL command to run before throwing an error.
Output
ResultThe result of the SQL command will be stored in a DataTable variable, allowing you to utilize it in subsequent activities or operations. DataTable variables to store the result of the query execution.

How to use:

  1. Drag and drop the "Execute Reader" activity onto the workflow.
  2. Configure the properties by specifying the NpgsqlConnection variable obtained from the "Connect" activity and the SQL query to be executed.
  3. Optionally, configure the delay, command timeout, and customize the display name.
  4. Execute the workflow to execute the specified query on the PostgreSQL database and retrieve the result as a DataTable.

Example: Consider an example where the "Execute Reader" activity is used to execute an SQL SELECT statement to retrieve employee data from a table:

Execute Reader:
Delay: 2
Connection: myDBConnection
Command Text: "SELECT * FROM Employees"
Command Timeout: 5000
Result: employeeData

In this example, the activity executes the SQL SELECT statement to retrieve all records from the "Employees" table. The result, representing the employee data, is stored in the DataTable variable "employeeData" for further processing in the workflow.